<?php
	session_start();	
	if(!isset($_SESSION['guest'])){
		$guest = $_POST['guest'];
		$username = $_POST['username'];
		$password = $_POST['password'];
		
		if($guest=='guest'){	
			$_SESSION['guest']= 'guest';
		}
		else if($guest=='not_guest'){
			if($username == 'admin' && $password == 'qwerty'){
				$_SESSION['username'] = $username;		
				$_SESSION['password'] = $password;
				$_SESSION['guest']='not_guest';
			}
			else{
				header("Location: index.php?error=1");
			}
		}
		else if ($guest=='babe'){
			header("Location: babe.php");
		}
		else{
			header("Location: index.php");
		}
	}
?>

<html>
<head>
	<title>MSCD Inventory</title>
</head>
	<frameset cols="25%,*">
		<frame src="mainmenu.php">
		<frame src="right_panel.php" name="output">
	</frameset>
</html>